const net = require('node:net');
const port = process.argv[2];
const server = net.createServer(function (socket) {
  // socket 处理逻辑
  const date = new Date();
  const year = date.getFullYear();
  const month = date.getMonth() + 1 // 调整为 1 到 12
  const day = date.getDate() // 返回当前月的日期
  const hours = date.getHours()
  const minutes = date.getMinutes();
  socket.end(`${year}-${month < 10 ? `0${month}` : month}-${day < 10 ? `0${day}` : day} ${hours < 10 ? `0${hours}` : hours}:${minutes < 10 ? `0${minutes}` : minutes}\n`)

});

server.listen(port);
